import React, { useRef } from 'react';
import styles from './index.less';
import Model from '@/components/model';
import { Button } from 'antd';
type Props = {};
export const MyContext = React.createContext(666); //创建ref

export default (props: Props) => {
  const modelRef = useRef<HTMLElement>(null);

  const refClick = () => {
    // @ts-ignore
    modelRef.current.open();
    console.log(MyContext, 'MyContext');
  };

  return (
    <div className={styles.pageviewContainer}>
      <Button type="default" onClick={refClick}>
        按钮
      </Button>
      <MyContext.Provider value={999}>
        <Model ref={modelRef}></Model>
      </MyContext.Provider>
    </div>
  );
};
